import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import Home from '@/components/Home'
// 同步路由，当页面首次加载的时候就会一起加载进来
// import Login from '@/components/Login'
// 改为异步路由，当访问到该页面的时候，再去加载页面资源
const Login = () => import(/* webpackChunkName: "userCenter" */ '@/components/Login')
const Register = () => import(/* webpackChunkName: "userCenter" */ '@/components/Register')

Vue.use(VueRouter)

Vue.config.productionTip = false

// 定义路由配置信息
const routes = [
  { path: '/', component: Home},
  { path: '/login', component: Login},
  { path: '/register', component: Register},
]

const router = new VueRouter({
  routes
})

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
